package com.klb.model;

import javax.persistence.*;

/**
 * Created by fujia on 2016/7/2.
 */
@Entity
@Table(name = "bbs_block", schema = "knowlogebase", catalog = "")
public class BbsBlock {
    private int blockId;
    private String title;
    private String text;

    @Id
    @Column(name = "block_id", nullable = false)
    public int getBlockId() {
        return blockId;
    }

    public void setBlockId(int blockId) {
        this.blockId = blockId;
    }

    @Basic
    @Column(name = "title", nullable = false, length = 32)
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Basic
    @Column(name = "text", nullable = false, length = 100)
    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;

        BbsBlock block = (BbsBlock) object;

        if (blockId != block.blockId) return false;
        if (title != null ? !title.equals(block.title) : block.title != null) return false;
        if (text != null ? !text.equals(block.text) : block.text != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = blockId;
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (text != null ? text.hashCode() : 0);
        return result;
    }
}
